using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class GameManager : SingletonPatternBase<GameManager>
{
    
    public PlayerModel playerData;

    public Vector2 MovementValue;
    public void InitData()
    {
        string playerDataStr = PlayerPrefs.GetString("PlayerData");
        if (playerDataStr == "")
        {
            playerData = new PlayerModel();
        }
        else
        {
            Debug.Log("playerDataStr"+playerDataStr);
            playerData = JsonUtility.FromJson<PlayerModel>(playerDataStr);
        }
        
    }

    public void  OnPlayerDataSave()
    {
        PlayerPrefs.SetString("PlayerData",JsonUtility.ToJson(playerData));
        PlayerPrefs.Save();
    }
}
